using System;
using System.Diagnostics.Contracts;

namespace OpenWaves.ActivityFeed.Web
{
    public class LikeEntryDto
    {
        public UserDto User { get; set; }
        public DateTime CreatedDate { get; set; }

        public static LikeEntryDto FromLike(LikeEntry like, IUserProfileProvider userProfileProvider)
        {
            Contract.Requires<ArgumentNullException>(like != null);
            Contract.Requires<ArgumentNullException>(userProfileProvider != null);

            return new LikeEntryDto()
                       {
                           CreatedDate = like.CreatedDate,
                           User = UserDto.FromUserId(like.UserId, userProfileProvider)
                       };
        }
    }
}